from CONN import conn
# 获取游标对象
cursor = conn.cursor()
# 捕获操作数据库的异常
try:
   #插入数据
   cursor.execute("insert into student(name,age,sex) values('李四四',22,'男') ")
# 获取刚插入数据的ID
   new_id = cursor.lastrowid
   print("刚刚数据插入的id:",new_id)
except Exception as e:
    print("更新数据失败:", e)
finally:
    # 关闭游标和连接是个好习惯
    cursor.close()
    conn.close()
    
#我是刚刚数据插入的id 10